package com.liu.zero;

import java.sql.*;
//测试sqlserver连接（注意导入sqlserver的JDBC包）
public class mssqlJdbc {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {

        Connection connection = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;DatabaseName=mvs","sa","1234");

        Statement statement = connection.createStatement();
        ResultSet execute = statement.executeQuery("select * from [mvs].[dbo].[sla]");
        while (execute.next()){
            System.out.println(execute.getString("rank"));
        }
    }
}
